<!DOCTYPE html >
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>申请上门取件</title>
        <link href="/css/share.css" rel="stylesheet" type="text/css" />
        <link href="/css/pickupservice.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="/admins/js/jquery/jquery-1.7.2.min.js"></script>
        <link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >
        <script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>
    </head>

    <body>
        <!--top-->
        <div class="top">
            <div class="top_jz">
                <div class="Community">
                    <ul>
                        <li><a href="/">悠奇网首页</a></li>
                        <li><a href="http://help.uuch.com/" target="_blank">帮助中心</a></li>
                        <li><a target="_blank" href="http://crm2.qq.com/page/portalpage/wpa.php?uin=800035006&f=1&ty=1&aty=0&a=&from=6" onClick="_gaq.push(['_trackEvent', 'qq', 'open', 'top']);" title="悠奇,省钱的个人跨国物流服务">悠奇在线客服</a></li>
                        <li><a href="http://weibo.com/u/2830203612" target="_blank">新浪微博</a></li>
                    </ul>
                </div>  
                <div class="user">
                        <ul>
                        <li class="user_login">
                            <?php if($this->isLogin){ ?>
                            <p><?php echo $this->user->nikename ?>! 欢迎来到悠奇！<a href="/user/logout">[退出]</a></p>
                            <?php }else{?>
                            <p>亲！欢迎来到悠奇！<a href="/user/login">[登录]</a><a href="/user/join">[注册]</a></p>
                            <?php }?>
                        </li>
                        <li class="user_cart"><a href="/purchase/cart"><span>购物车</span></a></li>
                        <li class="user_cart"><a href="/member/mail"><span>短消息</span><?php echo '<em class="'.($this->mainCount==0?'kong':'').'">'.$this->mainCount.'</em>'; ?></a></li>
                        <li class="user_cart"><a href="/tool/express"><span>运费试算</span></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="headerzy">
            <div class="headerzy_Center">
                <div class="logozy">
                    <div class="headerzy_logo">
                        <a href="/"><img src="/images/share/logo2.png" alt="悠奇网" /></a>
                    </div>
                    <div class="headerzy_lm">
                        <h1>申请上门取件</h1>
                        <div class="headerzy_dh">
                            <a href="javascript:void(0)" class="headerzy_s"><i></i>导航</a>
                            <div class="headerzy_xl" style="display:none;">
                                <a href="/member/home">我的账户</a>
                                <a href="/store/home">个人云仓库</a>
                                <a href="/purchase/index">代购服务</a>
                                <a href="/store/express">国际速递</a>
                                <a href="/tool/pay">跨国支付服务</a>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="headerzy_you">
                    <ul>
                        <li>国内上门取货</li>
                        <li>国外送货到家</li>
                    </ul>
                    <p>足不出户也能发国际快递，省时省力又省钱！</p>
                </div>
            </div>
        </div>
        <!--top-->
        <form method="post" action="/store/visitingway/" id="formvisiting">
        <div class="applyforbox">
            <div class="applyforcenter">

                <div class="applyforrh">
                    <div class="applyforn">
                        <h2>填写上门取件地址</h2>
                    </div>

                    <div class="applyxz">
                        <ul>
                            <?php foreach ($this->addressAll as $key => $addressVal) { ?>
                                <?php if($addressVal->Type == 1){ //国内地址显示?>
                                <li <?php echo $key == 0?'class="smxzon"':"";?>>
                                    <label><input name="addressId" class="addressId" id="addressId_<?=  $addressVal->id ?>" type="radio" value="<?php echo $addressVal->id;?>" <?php echo $key == 0?'checked':"";?>>
                                        <?php echo $addressVal->type,$addressVal->linkMan."，".$addressVal->CityByCityId->name.$addressVal->TownBy->name.$addressVal->street."，".$addressVal->mobile;?></label>
                                    <span><a href="javascript:void(0)" id="edit_address">修改</a><a href="javascript:void(0)" id="del_address">删除</a></span>
                                </li>
                                <?php } ?>
                            <?php }?>
                        </ul>
                        <div class="newtj" <?php echo count($this->addressAll)==0?'style="display:none;"':"";?>>
                            <p><a href="javascript:void(0)" id="new_address">+ 使用新取件地址</a></p>
                        </div>
                    </div>
                    <div class="smloading" style="display:none;">
                        <p><i></i>正在保存地址...</p>
                    </div>
                    <div class="applytable" <?php echo count($this->addressAll)==0?"":'style="display:none;"';?>>
                        <table>
                            <tr>
                                <td class="atz"><span>*</span>联 系 人：</td>
                                <td>
                                    <div class="dztext">
                                        <input class="textinput w250" type="text" id='linkMan' name='linkMan'/>
                                        <input type='hidden' id='address_id' name='address_id' value='' />
                                        <label class="error" style="display:none;"><i></i>请填写联系人</label>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="atz"><span>*</span>所在地区：</td>
                                <td>
                                    <div class="applyss">
                                        <div class="xlselect">
                                            <div class="xllist">
                                                <input class="textinput w120" type="text" id='city_name' name='city_name' value="请选择省份..." readOnly="true"/>
                                                <input type='hidden' id='city_id' name='city_id' value='' />
                                                <a href="javascript:void(0)"></a>
                                            </div>
                                            <div class="biaoxllb" style="display:none;" id='city_div'>
                                                
                                                <ul>
                                                    <?php foreach($this->cityAll as $cityVal){ ?>
                                                        <li><a href="javascript:void(0)" data='<?= $cityVal['id'] ?>'><?php echo $cityVal["name"];?></a></li>
                                                    <?php } ?>
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="xlselect">
                                            <div class="xllist">
                                                <input class="textinput w120" type="text" id='town_name' name='town_name' value="请选择城市..." readOnly="true"/>
                                                <input type='hidden' id='town_id' name='town_id' value='' />
                                                <a href="javascript:void(0)"></a>
                                            </div>
                                            <div class="biaoxllb" style="display:none;" id='town_div'>
                                                <ul>
                                                    <?php foreach($this->townAll as $townVal){ ?>
                                                        <li><a href="javascript:void(0)" data='<?php echo $townVal["id"];?>'><?php echo $townVal["name"];?></a></li>
                                                    <?php }?>
                                                </ul>
                                            </div>
                                        </div>
                                        <label class="error" style="display:none;"><i></i>请选择所在地</label>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="atz"><span>*</span>详细地址：</td>
                                <td>
                                    <div class="dztext">
                                        <input class="textinput w500" type="text" id='street' name='street'/>
                                        <label class="error" style="display:none;"><i></i>请填写详细地址</label>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="atz"><span>*</span>联系电话：</td>
                                <td>
                                    <div class="dztext">
                                        <input class="textinput w250" type="text" id='mobile' name='mobile' maxlength="20"/>
                                        <label class="error" style="display:none;"><i></i>请填写联系电话</label>
                                    </div>
                                </td>
                            </tr>
                        </table>
                        <div class="applytj">
                            <ul>
                                <li><a class="button11" href="javascript:void(0)" id='save_address'><span>确认并保存</span></a></li>
                                <li><a class="button1" href="javascript:void(0)" id='cancel_address'><span>取消</span></a></li>
                                <li><a class="button0" href="javascript:void(0)" id='reset_address'><span>清空</span></a></li>
                            </ul>
                        </div>
                    </div>
                </div>        

                <div class="applyforrh">
                    <div class="applyforn">
                        <h2>物品操作类型</h2>
                    </div>
                    <div class="applyfukuan">
                        <ul>
                            <li class="fkon"><label><input name="isWay" class="isWay" id="isWay_0" type="radio" value="0" checked>存入个人云仓库</label><p>可集中多个包裹一起提交国际快递，省钱、方便！</p></li>
                            <li><label><input name="isWay" class="isWay" id="isWay_1" type="radio" value="1">取件后直发海外</label><p>快速生成国际运单，简单便捷！</p></li>
                        </ul>
                    </div>            
                </div>
                <div class="applyforrh">
                    <div class="applyforn">
                        <h2>物品信息</h2>
                    </div>
                    <div class="wupin">
                        <table>
                            <tr>
                                <td class="atz"><span>*</span>物品名称：</td>
                                <td><div class="zhong"><input class="textinput w500" type="text" id="waresName" name="waresName"/></div></td>
                            </tr>
                            <tr>
                                <td class="atz"><span>*</span>物品描述：</td>
                                <td><textarea class="textarea w500" id="waresDescribe" name="waresDescribe"></textarea></td>
                            </tr>
                            <tr id="itemType_tr" style="display:none;">
                                <td class="atz"><span>*</span>包含属性：</td>
                                <td>
                                    <div class="suxing">
                                        <ul>
                                            <li><label><input name="itemType[]" id="itemType" type="checkbox" value="0">正常</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="1" />仿牌</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="2" />配套电池</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="256" />纯电池</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="4"/>液体</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="8" />食品</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="16"/>粉末</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="32" />膏状</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="512" />保健品</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="64"/>药品</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="1024" />眼镜</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="2048" />光盘</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="8192" />易碎品</label></li>
                                            <li><label><input type="checkbox" name="itemType[]" id="itemType" value="128" />其他敏感</label></li>
                                        </ul>
                                    </div>
                                    <div class="rushi">敏感物品请如实申报，避免选错国际快递方式导致无法运送！<a href="http://help.uuch.com/?p=708" target="_blank">查看详情</a></div>
                                </td>
                            </tr>
                            <tr>
                                <td class="atz"><span class="notnull"></span>物品重量：</td>
                                <td><div class="zhong"><input class="textinput w150" type="text" id="estimateWeight" name="estimateWeight"/><span>kg</span></div></td>
                            </tr>
                            <tr>
                                <td class="atz"><span class="notnull"></span>物品尺寸：</td>
                                <td><div class="chicun"><input class="textinput w30" type="text" id="length" name="length" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
                                    <i>X</i><input class="textinput w30" type="text" id="width" name="width" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
                                    <i>X</i><input class="textinput w30" type="text" id="height" name="height" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
                                    <span>cm</span></div></td>
                            </tr>
                        </table>
                    </div>
                </div>



                <div class="applyforrh">
                    <div class="applyforn">
                        <h2>物品运输类型</h2>
                    </div>
                    <div class="applyfukuan" id="sf_div">
                        
                    </div>
                    <input type="hidden" id="inlandMoney" name="inlandMoney" value="0" />
                </div>

                <div class="applyok">
                	<div style="color:red">上门取件会产生20元顺丰委托费，如您方便可自行联系快递寄到仓库地址！</div>
                    <div class="applytishi"><i></i>完成上门申请需预付100元保证金，此金可用来支付上门取件费和国际运费！</div>
                    <div class="ti">
                        <a class="button4" href="javascript:void(0)" id="submitSiviting"><span>确认并提交申请</span></a>
                    </div>
                </div>        
            </div>
        </div>
        </form>
        <!--foot-->
        <div class="foot">
	<div class="foot_center">
		<div class="f_top">
			<div class="ensure">
				<h3>安全保障</h3>
				<ul>
                    <li class="e1"><a onClick="_gaq.push(['_trackEvent', '安全认证', 'kexin', 'bottom']);" target="_blank" rel="nofollow" href="/other/kexin.html">可信网站<br>验证网站</a></li>
					<li class="e5"><a onClick="_gaq.push(['_trackEvent', '安全认证', '执照', 'bottom']);" href="http://help.uuch.com/?p=226" target="_blank">中国工商<br />注册信息</a></a></li>
					<li class="e4"><a onClick="_gaq.push(['_trackEvent', '安全认证', '360', 'bottom']);" target="_blank" rel="nofollow" href="http://webscan.360.cn/index/checkwebsite/url/uuch.com/">360绿色网站</a></li>          
				</ul>
			</div>
			<div class="symbiosis">
				<h3>合作伙伴</h3>
				<ul>
					<li>支付：<span><a rel="nofollow" target="_blank" href="http://www.alipay.com">支付宝</a></span><span><a rel="nofollow" target="_blank"  href="http://www.paypal.com">PayPal</a></span></li>
					<li>快递：<span><a target="_blank" rel="nofollow" href="http://www.dhl.com">DHL</a></span><span><a  target="_blank" rel="nofollow" href="http://www.ems.com.cn/">EMS</a></span><span><a target="_blank" rel="nofollow" href="http://intmail.183.com.cn/">邮政AIR</a></span><span><a rel="nofollow" target="_blank"  href="http://www.fedex.com">联邦快递</span></a></li>
				</ul>
			</div>
		</div>
		<div class="f_mid">
			<div class="foot_help">
				<div class="ask">
					<h3 class="a1">新手指南</h3>
					<ul>
						<li><a target="_blank" href="http://help.uuch.com/?p=13">注册新用户</a></li>
						
						<li><a target="_blank"  href="http://help.uuch.com/?p=4">什么是个人云仓库</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=8">什么是集中运送</a></li>
					</ul>
				</div>
				<div class="ask">
					<h3 class="a2">购物指南</h3>
					<ul>
						
						<li><a target="_blank"  href="http://help.uuch.com/?p=24">为什么要填物流信息</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=20">悠奇会帮我验货吗</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=11">关于进出境物品限制</a></li>
					</ul>
				</div>
				<div class="ask">
					<h3 class="a3">支付说明</h3>
					<ul>
						<li><a target="_blank"  href="http://help.uuch.com/?p=17">Paypal支付</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=15">悠奇账户充值方式</a></li>
                        <li><a target="_blank"  href="http://help.uuch.com/?p=41">如何退款</a></li>
					</ul>
				</div>
				<div class="ask">
					<h3 class="a4">配送说明</h3>
					<ul>
						<li><a target="_blank"  href="http://help.uuch.com/?p=28">运输方式和费用</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=33">海关及税项</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=26">国际转运服务流程</a></li>
					</ul>
				</div>
				<div class="ask">
					<h3 class="a5">售后服务</h3>
					<ul>
						<li><a target="_blank"  href="http://help.uuch.com/?p=37">退换货原则</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=39">商品退换货流程</a></li>
						<li><a target="_blank"  href="http://help.uuch.com/?p=41">如何退款</a></li>
					</ul>
				</div>
			</div>
			<div class="foot_ren">
				<div class="phone">
					<i>热线电话</i>
                    <div class="footphone">
                    	<h2>悠奇客服专线</h2>
                        <h3>+86-0755-88605979</h3>
                        <h4>周一至周日，早8:00至晚24:00</h4>
                    </div>
				</div>
				<div class="propose">
					<a target="_blank"  onClick="_gaq.push(['_trackEvent', 'qq', 'open', 'bottom']);" href="http://crm2.qq.com/page/portalpage/wpa.php?uin=800035006&f=1&ty=1&aty=0&a=&from=6" title="16小时在线悠奇客服">16小时在线客服...</a>
				</div>
				<p>客服邮箱：<a href="mailto:service@uuch.com">service@uuch.com</a></p>
			</div>
		</div>
		<div class="f_end">
			<div class="f_us">
                <a href="http://help.uuch.com/?p=47">关于悠奇网</a><span>|</span>
                <a href="http://help.uuch.com/?p=52">联系我们</a><span>|</span>
                <a href="/tool/link">友情链接</a></div>
			<p>Copyright &copy;2012 悠奇网中国商品购物平台! Inc. All rights reserved. <a target="_blank" rel="nofollow" href="http://www.miibeian.gov.cn/">粤ICP备12085307号</a> </p>
		</div>
	</div>
</div>
        <!--foot-->

    </body>
</html>
<script type="text/javascript">
$(document).ready(function(){ 
    
    TownIdBySFExpress();
    
    $(".headerzy_s").mouseenter(function(){
        $(this).addClass("headerzyon");
        $(this).next("div").show();
    });
    $(".headerzy_dh").mouseleave(function(){
        $(".headerzy_dh .headerzy_xl").hide();
        $(".headerzy_dh .headerzy_s").removeClass("headerzyon");
    });
    $("#new_address").click(function(){
       $(".applytable").show();
       $(this).hide();
       $(".applyxz").hide();
    });
    $(".xllist").click(function(){
        $(".xllist").next("div").hide();
        $(this).next("div").show();
    });
     $('#city_div ul a').bind("click",function(){
        $(this).parents('.xlselect').find('.xllist input[id="city_name"]').val($(this).text());
        var cityId = $(this).attr("data");
        $(this).parents('.xlselect').find('.xllist input[id="city_id"]').val(cityId);
        CityByTown(cityId);
    })   
    $('#town_div ul a').live("click",function(){
        $(this).parents('.xlselect').find('.xllist input[id="town_name"]').val($(this).text());
        var townId = $(this).attr("data");
        $(this).parents('.xlselect').find('.xllist input[id="town_id"]').val(townId);
        $(".xllist").next("div").hide();
    });
    $("#save_address").click(function(){
        var posts = {};
        posts["linkMan"] = $("#linkMan").val();
        posts["cityId"] = $("#city_id").val();
        posts["townId"] = $("#town_id").val();
        posts["street"] = $("#street").val();
        posts["mobile"] = $("#mobile").val();
        posts["addressId"] = $("#address_id").val();
        var city_name = $("#city_name").val();
        var town_name = $("#town_name").val();
        var cksubmit = true;
        if(posts["linkMan"] == ""){
            $("#linkMan").next("label").show();
            cksubmit = false;
        }else{
            $("#linkMan").next("label").hide();
        }
        if(posts["cityId"] == ""){
            $("#city_id").parents('.applyss').find("label").show();
            cksubmit = false;
        }else{
            $("#city_id").parents('.applyss').find("label").hide();
        }
        if(posts["townId"] == ""){
            $("#town_id").parents('.applyss').find("label").show();
            cksubmit = false;
        }else{
            $("#town_id").parents('.applyss').find("label").hide();
        }
        if(posts["street"] == ""){
            $("#street").next("label").show();
            cksubmit = false;
        }else{
            $("#street").next("label").hide();
        }
        if(posts["mobile"] == ""){
            $("#mobile").next("label").show();
            cksubmit = false;
        }else{
            $("#mobile").next("label").hide();
        }
        if(cksubmit){
            $(".smloading").show();
            $(".applytable").hide();
             $.post('/store/newaddress', posts, function(data){
                if(data == 0){
                    alert("请填写有效地址");
                } else {
                    if(data == posts["addressId"]){
                        var html = '<label><input name="addressId" class="addressId" id="addressId_'+data+'" type="radio" value="'+data+'">&nbsp;';
                        html+= posts["linkMan"]+'，'+city_name+town_name+posts["street"]+'，'+posts["mobile"];
                        html+= '</label><span><a href="javascript:void(0)" id="edit_address">修改</a><a href="javascript:void(0)" id="del_address">删除</a></span>';
                        $(".applyxz ul li input[value='"+data+"']").parents("li").html(html);
                    }else{
                        var html = '<li><label><input name="addressId" class="addressId" id="addressId_'+data+'" type="radio" value="'+data+'">&nbsp;';
                        html+= posts["linkMan"]+'，'+city_name+town_name+posts["street"]+'，'+posts["mobile"];
                        html+= '</label><span><a href="javascript:void(0)" id="edit_address">修改</a><a href="javascript:void(0)" id="del_address">删除</a></span></li>';
                        $(".applyxz ul").append(html);
                    }
                    $(".addressId").parents("ul li").removeClass("smxzon");
                    $("#addressId_"+data).parents("li").addClass("smxzon");
                    $("#addressId_"+data).attr("checked","true");
                    TownIdBySFExpress();
                    AddressIdAndShipIdAndWeightByMoney();
                    $("#reset_address").click();
                    $("#new_address").show();
                    $(".applyxz").show()
                    $(".newtj").show();
                    $(".smloading").hide();
                }
            }, 'json'); 
        }
    });
    $("#edit_address").live("click",function(){
        var address_id = $(this).parents('li').find('label input[name="addressId"]').val();
        $.post('/store/addressdetail', {"addressId":address_id}, function(data){
            if(data.type == 1){
                $("#linkMan").val(data.linkMan);
                $("#city_id").val(data.cityId);
                $("#town_id").val(data.townId);
                $("#city_name").val(data.cityName);
                $("#town_name").val(data.townName);
                $("#street").val(data.street);
                $("#mobile").val(data.mobile);
                $("#address_id").val(data.addressId);
                CityByTown(data.cityId);
                $(".applytable").show();
                $(this).hide();
                $(".applyxz").hide();
            }else{
                alert("出现未知错误");
            }
        }, 'json'); 
    });
    $("#del_address").live("click",function(){
        var address_id = $(this).parents('li').find('label input[name="addressId"]').val();
        
        $.post('/store/deladdress', {"addressId":address_id}, function(data){
            if(data.status == 1){
                var checked = $(".applyxz ul li input[value='"+address_id+"']").attr("checked");
                if(checked == "checked"){
                    $(".addressId").first().click();
                }
                $(".applyxz ul li input[value='"+address_id+"']").parents("li").remove();
                if(data.num == 0){
                    $("#new_address").click();
                }
            }else{
                alert("出现未知错误");
            }
        }, 'json'); 
    });
    $("#cancel_address").click(function(){
        $(".applytable").hide();
        $("#new_address").show();
        $(".applyxz").show();
    });
    $("#reset_address").click(function(){
        $("#linkMan").val("");
        $("#city_id").val("");
        $("#town_id").val("");
        $("#city_name").val("请选择省份...");
        $("#town_name").val("请选择城市...");
        $("#street").val("");
        $("#mobile").val("");
        $("#address_id").val("");
    });
    $(".addressId").live("change",function(){
        $(".addressId").parents("ul li").removeClass("smxzon");
        $(this).parents("li").addClass("smxzon");
        AddressIdAndShipIdAndWeightByMoney();
        TownIdBySFExpress();
    });
    $(".isWay").live("change",function(){
        $(".isWay").parents("ul li").removeClass("fkon");
        $(this).parents("li").addClass("fkon");
        var isWay = $(".isWay:checked").val();
        if(isWay == 1){
            $(".wupin .atz .notnull").text("*");
            $("#itemType_tr").show();
            $(".ti a span").text("填写国际运单信息")
        }else{
            $(".wupin .atz .notnull").text("");
            $("#itemType_tr").hide();
            $(".ti a span").text("确认并提交申请")
        }
    });
    $(".shipType").live("change",function(){
        $(".shipType").parents("ul li").removeClass("fkon");
        $(this).parents("li").addClass("fkon");
        AddressIdAndShipIdAndWeightByMoney();
    });
    $('#length,#width,#height,#estimateWeight').change(function(){
        AddressIdAndShipIdAndWeightByMoney();
    });
    $("#submitSiviting").click(function(){
        
        var waresName = $("#waresName").val();
        var waresDescribe = $("#waresDescribe").val();
        var addressId = $(".addressId:checked").val();
        var shipId = $(".shipType:checked").val();
        var isWay = $(".isWay:checked").val();
        if(isWay == 1){
            if($("#estimateWeight").val() == ""){
                alert("物品重量不能为空");
                return false;
            }
            if($("#length").val() == "" || $("#width").val() == "" || $("#height").val() == ""){
                alert("物品提交重量长宽高不能为空");
                return false;
            }
        }   
        if(waresName == ""){
            alert("物品名称不能为空");
            return false;
        }else if(waresDescribe == ""){
            alert("物品描述不能为空");
            return false;
        }else if(addressId == undefined){
            alert("请选择上门取件地址");
            return false;
        }else if(isWay == undefined){
            alert("请选择物品操作类型");
            return false;
        }else if(shipId == undefined){
            alert("请选择物品运输类型");
            return false;
        }else{
            $("#formvisiting").submit();
            $('#submitSiviting').val("正在提交");
            $('#submitSiviting').unbind('click');
            return false;
        }
    });
    function AddressIdAndShipIdAndWeightByMoney()
    {
        var addressId = $(".addressId:checked").val();
        var shipId = $(".shipType:checked").val();
        var shipName = $(".shipType:checked").parents("label").text();
        var estimateWeight = $("#estimateWeight").val();
        estimateWeight = estimateWeight?estimateWeight:0;
        var length = $("#length").val();
        length = length?length:0;
        var width = $("#width").val();
        width = width?width:0;
        var height = $("#height").val();
        height = height?height:0;
        var volume = length*width*height/6000;
        var weight = estimateWeight>volume?estimateWeight:volume;
        if(weight == 0 || addressId == undefined){
            $(".fkts").html('<p>您的选择为'+shipName+'，如需查询取件费用，请点击<a href="/tool/visiting" target="_blank">查询国内运费&gt;&gt;</a></p>');
        }else{
            $.ajax({    
                type: 'POST',
                url: '/store/calculatemoney/addressId/'+addressId+"/weight/"+weight+"/shipId/"+shipId,
                success: function(data) {
                    if(data.status == 1){
                        $("#inlandMoney").val(data.money);
                        $(".fkts").html('<p>您的选择为'+shipName+'重量为<span>'+weight+'kg</span>预测费用为<span>'+data.money+'元</span>，以顺丰实际收取费用为准！请点击<a href="/tool/visiting" target="_blank">查询国内运费&gt;&gt;</a></p>');
                    }else{
                        $(".fkts").html('<p>您的选择为'+shipName+'，如需查询取件费用，请点击<a href="/tool/visiting" target="_blank">查询国内运费&gt;&gt;</a></p>');
                    }
                }
            });
        }
    }
    function CityByTown(cityId)
    {
        $.ajax({    
            type: 'POST',
            url: '/store/citysubtown/cityid/'+cityId,
            success: function(data) {
                if(data.arrtown){
                    var html = "";
                    $.each(data.arrtown, function(key, val) {
                        if(key == 0){
                            $("#town_name").val(val.name);
                            $("#town_id").val(val.id);
                        }   
                        html+= '<li><a href="javascript:void(0)" data="'+val.id+'" >'+val.name+'</a></li>';
                    });
                    $("#town_div ul").html(html);
                 }
                 $(".xllist").next("div").hide();
            }
        });
    }
    function TownIdBySFExpress()
    {
        var addressId = $(".addressId:checked").val();
        if(!addressId){
            return;
        }
        $.ajax({    
            type: 'POST',
            url: '/store/sfexpress/addressid/'+addressId,
            success: function(data) {
                $("#sf_div").html(data);
                AddressIdAndShipIdAndWeightByMoney();
            }
        });
        
    }
    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".xlselect").length == 0){
            $(".xllist").next("div").hide();
        }
   });
});
</script>